<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.researchsubject.domain.*" pageEncoding="UTF-8"%>
<%@page import="com.hs.core.page.PageUtil,com.hs.core.utils.*,cn.ac.cintcm.dataconverge.researcher.domain.*"%>
<%@page import="cn.ac.cintcm.dataconverge.util.Constants;"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
PageUtil pageUtil = (PageUtil)request.getAttribute("myadvisesubjectList");
List resultList = null;
String pageStr = ""; 
int perpageCount = 1;
int currentPage = 1;
if(null != pageUtil){
   resultList = pageUtil.getPageList();
   pageStr = pageUtil.getPageStr();
   perpageCount = pageUtil.getNumberPerPage();
   currentPage = pageUtil.getCurrentPage();
}
String subjectname = (String)request.getAttribute("subjectname");
String startdate = (String)request.getAttribute("startdate");
String enddate = (String)request.getAttribute("enddate");
String startyear = (String)request.getAttribute("startyear");
String endyear = (String)request.getAttribute("endyear");
String snumber = (String)request.getAttribute("snumber");
String status = (String)request.getAttribute("status");

String onreserach = (String)request.getAttribute("onreserach");
String onpermit = (String)request.getAttribute("onpermit");
String finishSubject = (String)request.getAttribute("finishSubject");

String orderName = (String)request.getAttribute("orderName");
String orderNum = (String)request.getAttribute("orderNum"); 
String orgId = (String)request.getAttribute("orgId"); 
List orgList = (List)request.getAttribute("orgList");
List dictList = (List)request.getAttribute("dictList");
String subjectUser = (String)request.getAttribute("subjectUser");

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>课题信息</title>
    <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    <link href="<%=path%>/index/Themes/com/style.css" rel="stylesheet" type="text/css" /> 
    <script src="<%=path%>/index/Scripts/Script.js" language="javascript" type="text/javascript"></script>
     <script src="<%=path%>/js/common.js" language="javascript" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" type="text/javascript">
       function delSubject(id){
       		if(null != id && id != '' ){
       		 	if(confirm("确认删除课题?")){
       		 		form1.action = '<%=path%>/subjectToAdd.htm?action=delSubject&id='+id;
       		 		form1.submit();
       		 	}
       		}
       
       }
       function searchSubject(){ 
       	
       			searchform.submit();			
       }
    </script>

</head>
<body class="rtm_body" scroll=yes>
<form name="searchform" action = "<%=path%>/subject.htm?action=listAdvisedSubjects" method="post">
    <div class="r_rtm_tb_mg1">
        <div class="r_rtm_tb1">
            <span>
                <img src="<%=path%>/index/Themes/com/idt_tb_pass.gif" />&nbsp;&nbsp;推荐中标的课题</span>
        </div>
    </div>  
     <table cellspacing="2" cellpadding="0" width="100%" class="idt_item_mg" id="Table2">
         <tr>
            <td class="fim_l" width="8%">
                课题名称：</td>
            <td class="fim_r" width="20%">
                <input type="text" name="subjectname" value="<%=subjectname==null?"":subjectname %>" class="com_textbox" ></td>
            <!-- td class="fim_l">
                申报日期：</td>
            <td class="fim_r" nowrap width="30%">
                从
               <input type="text" class="Wdate" id="startdate" value="<%=startdate==null?"":startdate %>" style="width:40%" name="startdate"  onFocus="WdatePicker({el:'startdate',dateFmt:'yyyy-MM-dd'})" />
                &nbsp;至
               <input type="text" class="Wdate" id="enddate" value="<%=enddate==null?"":enddate %>" style="width:40%" name="enddate"  onFocus="WdatePicker({el:'enddate',dateFmt:'yyyy-MM-dd'})" />
            </td-->
            <td class="fim_l" width="8%">
                完成单位：</td>
            <td class="fim_r" nowrap width="20%">
               <select name="orgId" style="width:100%">
                <option value=""></option>
                <%
                
                 if(orgList.size()>0){ 
                	 for(int i =0;i<orgList.size();i++){
                		 Organization org = (Organization)orgList.get(i);
                		 out.print("<option value=");
                		 out.print(org.getId());
                		 if((org.getId()+"").equals(orgId))
                		 	out.print(" selected");
                		 out.print(">");
                		 out.print(org.getName());
                		 out.print("</option>");
                	 }
                 }
                %>
                </select>
            </td>
             <td class="fim_l" width="8%">
                课题负责人：</td>
            <td class="fim_r" width="20%">
                <input type="text" name="subjectUser" value="<%=subjectUser==null?"":subjectUser %>" class="com_textbox" id="Text2" name="Text2"></td>
            <td class="fim_r" align="right"  width="20%">
                <input type="submit" value="查询"  onclick="searchSubject()" class="com_btn2" id="Button5">
                <input type="button" value="高级查询"   onclick="if(AdCheckForm.style.display=='none')AdCheckForm.style.display='';else AdCheckForm.style.display='none';"
                    class="com_btn2" id="Button1">
                
            </td>
        </tr>
         
        <tr id="AdCheckForm" style="display: none;">
            <td class="fim_l">
                课题编号：</td>
            <td class="fim_r">
                <input type="text" class="com_textbox" id="snumber" value="<%=snumber==null?"":snumber %>" name="snumber"></td>
            <td class="fim_l">
                所属年份：</td>
            <td class="fim_r">
                从
               <input type="text" class="Wdate" id="startyear" value="<%=startyear==null?"":startyear %>" style="width:40%" name="startyear"  onFocus="WdatePicker({el:'startyear',dateFmt:'yyyy'})" />
                &nbsp;至
               <input type="text" class="Wdate" id="endyear" value="<%=endyear==null?"":endyear %>" style="width:40%" name="endyear"  onFocus="WdatePicker({el:'endyear',dateFmt:'yyyy'})" />
            </td>
            <td class="fim_l">
               </td>
            <td class="fim_r"> 
                  
            </td>
             <td class="fim_r"> 
                  
            </td>
        </tr>
        
   </form>
    </table> 
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
        <tr>
            <td>
                <div class="content">
                 <form name="form1" action="" method="post">
                    <table width="*" cellpadding="0" cellspacing="1" class="dg_borderstyle" id="Table4">
                        <tr>
                            <td class="dg_headerstyle" width="5%">
                                序号</td>
                           <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('snumber','<%=OrderTool.getOrderNum("snumber",orderName,orderNum)%>');">课题编号&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("snumber",orderName,orderNum))%></a></td>
                            <td class="dg_headerstyle" width="20%">
                                <a href="javaScript:orderPage('subjectname','<%=OrderTool.getOrderNum("subjectname",orderName,orderNum)%>');">课题名称&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("subjectname",orderName,orderNum))%></a></td>
                            <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('state','<%=OrderTool.getOrderNum("state",orderName,orderNum)%>');">当前状态&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("state",orderName,orderNum))%></a></td>
                           
                                 <td class="dg_headerstyle">
                                负责人</td> 
                                 <td class="dg_headerstyle">
                                牵头单位</td>
                            <td class="dg_headerstyle">
                                课题来源</td>
                            <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('startdate','<%=OrderTool.getOrderNum("startdate",orderName,orderNum)%>');">计划开始日期&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("startdate",orderName,orderNum))%></a></td>
                                  <td class="dg_headerstyle" width="10%">
                                 <a href="javaScript:orderPage('enddate','<%=OrderTool.getOrderNum("enddate",orderName,orderNum)%>');">计划结束日期&nbsp;&nbsp;<%=OrderTool.getOrderImage(basePath,OrderTool.getOrderNum("enddate",orderName,orderNum))%></a></td>
                                  <td class="dg_headerstyle" nowrap>
                                查 看</td>  
                        </tr>
                        <%if(null != resultList && resultList.size()> 0){
                            for(int i = 0;i < resultList.size();i++){
                                    Subject obj = (Subject)resultList.get(i); 
                         %>
                        <tr class="dg_alternatingitemstyle" onmouseover="ChangeRowBg(this);" onmouseout="ChangeRowBg(this);" onmouseup="ChangeRowBg(this);" onmousedown="ChangeRowBg(this);">
                            <td align="center"><%= perpageCount*(currentPage-1)+i+1 %></td>
                            <td>
                             <%=StringUtilTool.NULL2Blank(obj.getSnumber()) %>
                            </td>
                            <td>
                                <a href="#"   onclick="openwindow('<%=path %>/subjectToAdd.htm?action=viewSubject&id=<%=obj.getId() %>','','','')"> <%=StringUtilTool.NULL2Blank(obj.getSubjectname()) %></a>
                            </td>
                            <td>
                                <font color="red"><%=Constants.getSubjectStatus(obj.getState()) %></font>
                            </td>
                            <td>
                               <%
                                   if(obj != null){
                                     Set res = obj.getSubRes();
                                     Iterator it = res.iterator();
                                     int j = 0;
                                     while(it.hasNext()){
                                    	
                                         SubRes rearcher = (SubRes)it.next();
                                         if(Constants.researcher_role_chargeman.equals(rearcher.getResRole()+"")){
                                        	 j++;
                                        	 out.println(rearcher.getRes()==null?"":rearcher.getRes().getName()+"&nbsp;"); 
                                         }
                                        // if(j>1)
                                        //	 out.println(",");
                                     }
                                   } 
                                 %>
                            </td>
                            <td>
                               <%
                                   if(obj != null){
                                     Set orgs = obj.getSubOrg();
                                     Iterator it = orgs.iterator();
                                     int h = 0;
                                     while(it.hasNext()){
                                    	  
                                         SubOrg org = (SubOrg)it.next();
                                         if(Constants.org_role_leader.equals(org.getOrgRole()+"")){
                                        	 out.println(org.getOrg()==null?"":org.getOrg().getName()+"&nbsp;"); 
                                          	 
                                          }
                                         //if(h>1)
                                        //	 out.println(",");
                                     }
                                   } 
                                 %>
                            </td>
                            <td>
                                 <%
                                   if(obj != null){
                                     Set tags = obj.getTags();
                                     Iterator ittag = tags.iterator();
                                     while(ittag.hasNext()){
                                    	 SubTag tag = (SubTag)ittag.next();
                                         if(null != tag && tag.getTag() != null && tag.getTag().getTagType() == 1)
                                         	out.println( tag.getTag().getName()+"&nbsp;");
                                     }
                                   } 
                                 %>
                            </td>
                            
                            <td>
                                <%=Tools.getDateStringByDate1(obj.getStartdate()) %>
                            </td> 
                            <td>
                                 <%=Tools.getDateStringByDate1(obj.getEnddate()) %>
                            </td>
                           <td align="center">
                                  <a href="#"   onclick="openwindow('<%=path %>/subjectToAdd.htm?action=viewSubject&id=<%=obj.getId() %>','','','')"><img src="<%=path %>/index/Themes/com/zoom_16x16.gif" alt="查看"  style="cursor:hand" /></a>
                            </td> 
                        </tr> 
                        <%}}else{%>
                         <tr class="dg_alternatingitemstyle"> 
                            <td align="center" colspan=11>
                                <font color="red">没有找到记录</font>
                            </td> 
                        </tr> 
                        <%}%>
                    </table>
                    </form>
                    <div class="dg_pagerstyle" align="right"> 
                            <%=pageStr %>  
                    </div> 
                </div>
            </td>
        </tr>
    </table>
</body>
</html>
